﻿using System;
using DiffuseEnjoyIdle.Core.Enums;
using DiffuseEnjoyIdle.Core.Helper;

using System;

using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace System.Linq
{
    /// <summary>
    ///小于等于
    /// </summary>
    public sealed class ExpBuilderLessThanOrEqual : ExpressionBuilder, IExpressionBuilder
    {
        public ExpBuilderLessThanOrEqual()
        {
            base.OpType = Enum_ConditionType.LessEqual;
            base.EndKey = Enum_ConditionType.LessEqual.ToString();
        }

        protected override Expression GenExp(Expression left, Expression right)
        {
            if (left.Type.IsEnum)
            {
                left = Expression.Convert(left, typeof(long));
                right = Expression.Convert(right, typeof(long));
            }
            return Expression.LessThanOrEqual(left, right);
        }
    }
}